package com.lemon.components.ant.beans;

import java.util.List;

import com.lemon.components.ant.project.beans.TableInfo;

public class ProjectInfo {

	//项目信息
	private String groupId;
	private String artifactId;
	private String companyName;
	private String description;
	private String serverPort = "8080";
	//位置信息
	private String projectPath;
	private String templatePath;
	private String modelName;
	//数据库信息
	private String dbname;
	private String dbhost;
	private String dbinfo;
	private String dbdrivername = "com.mysql.cj.jdbc.Driver";
	private String dbusername;
	private String dbpasswd;
	private List<TableInfo> tables;
	
	public String getGroupId() {
		groupId = "com."+companyName+"."+artifactId;
		return groupId;
	}
	public void setGroupId(String groupId) {
		this.groupId = groupId;
	}
	public String getArtifactId() {
		return artifactId;
	}
	public void setArtifactId(String artifactId) {
		this.artifactId = artifactId;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public String getProjectPath() {
		return projectPath;
	}
	public void setProjectPath(String projectPath) {
		this.projectPath = projectPath;
	}
	public String getTemplatePath() {
		return ProjectInfo.class.getResource("/code").getPath();
	}
	public void setTemplatePath(String templatePath) {
		this.templatePath = templatePath;
	}
	public String getModelName() {
		return modelName;
	}
	public void setModelName(String modelName) {
		this.modelName = modelName;
	}
	public String getGroupPath() {
		String[] tmp = this.getGroupId().split("\\.");
		StringBuilder sb = new StringBuilder();
		for(String t:tmp) {
			sb.append(t);
			sb.append("/");
		}
		return sb.toString();
	}
	public String getCompanyName() {
		return companyName;
	}
	public void setCompanyName(String companyName) {
		this.companyName = companyName;
	}
	public String getDbusername() {
		return dbusername;
	}
	public void setDbusername(String dbusername) {
		this.dbusername = dbusername;
	}
	public String getDbpasswd() {
		return dbpasswd;
	}
	public void setDbpasswd(String dbpasswd) {
		this.dbpasswd = dbpasswd;
	}
	public String getDbdrivername() {
		return dbdrivername;
	}
	public void setDbdrivername(String dbdrivername) {
		this.dbdrivername = dbdrivername;
	}
	public String getDbname() {
		return dbname;
	}
	public void setDbname(String dbname) {
		this.dbname = dbname;
	}
	public String getDbhost() {
		return dbhost;
	}
	public void setDbhost(String dbhost) {
		this.dbhost = dbhost;
	}
	public String getDbinfo() {
		return "jdbc:mysql://"+dbhost+"/information_schema?useSSL=false";
	}
	public void setDbinfo(String dbinfo) {
		this.dbinfo = dbinfo;
	}
	public List<TableInfo> getTables() {
		return tables;
	}
	public void setTables(List<TableInfo> tables) {
		this.tables = tables;
	}
	public String getServerPort() {
		return serverPort;
	}
	public void setServerPort(String serverPort) {
		this.serverPort = serverPort;
	}
}
